﻿#include <iostream>
#include <string>﻿
using namespace std;

int main(int argc, char* argv[])
{
	string s1 = "How are you?";
	string s2 = " ";
	string str;  int p1 = 0;  int p2 = 0;
	      //p1 = 3    
	while ((p1 = s1.find_first_of(s2, p1)) != string::npos)
	{
		str = s1.substr(p2, p1 - p2);//p1-p2 = 3
		cout << str << endl;//str = "How " "are " "you?"
		p2 = ++p1;//p2 = 4  
	}
	if (p2 != s1.size())
	{
		str = s1.substr(p2, p1 - p2);
		cout << str << "MM"<<endl;
	}
	cout <<"XXXX"<< endl;
	return 0;
}

